﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace Pampa.MVC.Test
{
    [TestFixture]
    public class DemoModelTestCase
    {
        [Test]
        public void DropSchema()
        {
            // Configuración de ActiveRecord
            System.Reflection.Assembly asmModel = System.Reflection.Assembly.Load("Demo.Model");
            Castle.ActiveRecord.Framework.IConfigurationSource configSource = Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler.Instance;
            Castle.ActiveRecord.ActiveRecordStarter.Initialize(asmModel, configSource);

            Castle.ActiveRecord.ActiveRecordStarter.DropSchema();
        }

        [Test]
        public void CreateSchemaAndPopulate()
        {
            // Configuración de ActiveRecord
            System.Reflection.Assembly asmModel = System.Reflection.Assembly.Load("Demo.Model");
            Castle.ActiveRecord.Framework.IConfigurationSource configSource = Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler.Instance;
            Castle.ActiveRecord.ActiveRecordStarter.Initialize(asmModel, configSource);

            // Crea el schema de base de datos a partir de los objetos de negocio
            Castle.ActiveRecord.ActiveRecordStarter.CreateSchema();
            Demo.Model.Utils.DataManager.FillDemoData();
        }
    }
}
